package enterprises

import grails.test.*

class ProductionTests extends GrailsUnitTestCase {
	Production production
    protected void setUp() {
        super.setUp()
		production = new Production(enterprise: new Enterprise())
		production.name = ""
		mockForConstraintsTests(Production, [production])
    }

    protected void tearDown() {
        super.tearDown()
    }

    void testEmptyName() {		
		assertFalse production.validate()
		assertEquals "blank", production.errors.name
    }
	
	void testSmallName() {
		production.name = "as"
		assertFalse production.validate()
		assertEquals "minSize", production.errors.name
	}
	
	void testNegativeMonthlySize() {
		production.name = "name"
		production.monthlySize = -1
		println production.errors
		assertFalse "not valid", production.validate()		
		assertEquals "min", production.errors.monthlySize
	}
}
